package com.augurit.gzcgwsp.sendNotice.convert;

import java.util.ArrayList;
import java.util.List;

import org.dozer.DozerBeanMapper;
import com.augurit.gzcgwsp.sendNotice.entity.YwWebserviceInfo;
import com.augurit.gzcgwsp.sendNotice.web.form.YwWebserviceInfoForm;

public class YwWebserviceInfoConvert {
	public static YwWebserviceInfoForm convertVoToForm(YwWebserviceInfo entity) {
		if(entity != null) {
			YwWebserviceInfoForm form = new DozerBeanMapper().map(entity, YwWebserviceInfoForm.class);
			return form;
		}else
			return null;
	}
	
	public static List<YwWebserviceInfoForm> convertVoListToFormList(List<YwWebserviceInfo> wWebserviceInfoList) {
		if(wWebserviceInfoList != null && wWebserviceInfoList.size() > 0) {
			List<YwWebserviceInfoForm> ywYnJzfqwczzXnFormList = new ArrayList();
			for(int i=0; i<wWebserviceInfoList.size(); i++) {
				ywYnJzfqwczzXnFormList.add(convertVoToForm(wWebserviceInfoList.get(i)));
			}
			return ywYnJzfqwczzXnFormList;
		}
		return null;
	}
	
	
	public static void convertFormToVo(YwWebserviceInfoForm form, YwWebserviceInfo entity) {
        if (form == null) return;
        if (entity == null) entity = new YwWebserviceInfo();        
        new DozerBeanMapper().map(form, entity);
    }
	
	public static List<YwWebserviceInfo> convertFormListToVoList(List<YwWebserviceInfoForm> YwWebserviceInfoFormList) {
		if(YwWebserviceInfoFormList != null && YwWebserviceInfoFormList.size() > 0) {
			List<YwWebserviceInfo> ywWebserviceInfoList = new ArrayList();
			for(int i=0; i<YwWebserviceInfoFormList.size(); i++) {
				YwWebserviceInfo YwWebserviceInfo = new YwWebserviceInfo();
				convertFormToVo(YwWebserviceInfoFormList.get(i), YwWebserviceInfo);
				ywWebserviceInfoList.add(YwWebserviceInfo);
			}
			return ywWebserviceInfoList;
		}
		return null;
	}
	
}
